import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/Home'
import Doc from '@/components/Doc'
import Code from '@/components/Code'
import Upload from '@/components/Upload'
import Log from '@/components/Log'
import LogDetail from '@/components/LogDetail'
import AddCate from '@/components/AddCate'
import AddApi from '@/components/AddApi'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {path: '/doc', name: 'Doc', component: Doc},
        {path: '/code', name: 'Code', component: Code},
        {path: '/upload', name: 'Upload', component: Upload},
        {path: '/log', name: 'Log', component: Log},
        {path: '/logDetail/:id', name: 'LogDetail', component: LogDetail},
        {path: '/addCate/:level/:id', name: 'AddCate', component: AddCate},
        {path: '/addApi/:cate', name: 'addApi', component: AddApi},
        {path: '*', name: '*', redirect: '/doc'}
      ]
    }
  ]
})
